<?php

namespace App\Http\Requests\AdminApi\Dev;

use App\Rules\{NotZero,InField,HaveZero,ZeroOne,ArrValidator};

class SettingsReq extends \App\Http\Requests\AdminApi\Dev\BaseReq
{

    public function __construct(protected $rule = [
        'upload_slice_size' => ['required', "numeric","min:100","max:1024",new NotZero],
        'upload_max_size' => ['required', "numeric","min:0","max:204800",new HaveZero],
        'upload_file_type' => ["present","array",new ArrValidator(["type" => ['required','string'],"name" => ['required','string'] ])],
        'upload_check_file_type' => ["required",new ZeroOne],
        'field' => ['required', new InField(["upload_slice_size","upload_max_size","upload_file_type","upload_check_file_type", "oss_start", "oss_access_key_id", "oss_access_key_secret", "oss_endpoint", "oss_bucket" , "oss_role_arr"])],
    ]){}
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }



    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function scene()
    {
        return [
            'setItem' => ['upload_slice_size','upload_max_size','upload_file_type','upload_check_file_type'],
            'getItem' => ['field'],
        ];
    }
}
